package main;

import java.util.HashMap;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
 
public class ReadXMLFile {
 
   
   
   public static void main(String argv[]) {
 
    try {
 
	SAXParserFactory factory = SAXParserFactory.newInstance();
	SAXParser saxParser = factory.newSAXParser();
	
	/*
	 * will hold the mapping between node's id to the route's id
	 */
	HashMap<Integer,Integer> nodeIdToRoutIdMap = new HashMap<Integer, Integer>();
	
	/*
	 *  will hold the mapping between serialized route to the route's index 
	 */
	HashMap<Integer,String> routeIdToSerializedRouteMap = new HashMap<Integer, String>();
	
	/*
	 * will hold the mapping between the labelId to the label's name
	 */
	HashMap<Integer,String> labelIdToLabelMap = new HashMap<Integer, String>();
	
	DefaultHandler handler = new MyHandler(nodeIdToRoutIdMap,routeIdToSerializedRouteMap,labelIdToLabelMap);
	
       saxParser.parse("D:\\development\\dblab\\file.xml", handler);
 
       System.out.println("hoooooray!");
     } catch (Exception e) {
       e.printStackTrace();
     }
     
     
 
   }
 
}